﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

public partial class AddArticle : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void sendButton_Click(object sender, EventArgs e)
    {
        if (titleNews.Text.Length > 0 && titleNews.Text.Length < 50)
        {
            if (new BLL.Articles().SendArticle(titleNews.Text, AddNewsFCKeditor.Value, HttpContext.Current.User.Identity.Name))
            {
                PlaceHolder1.Controls.Clear();
                Label l = new Label();
                l.Text = stateMess.Text = "Статья успешно добавлена!";
                PlaceHolder1.Controls.Add(l);
            }
            else
            {
                PlaceHolder1.Controls.Clear();
                Label l = new Label();
                l.Text = stateMess.Text = "Ваша статья не добавлена!";
                PlaceHolder1.Controls.Add(l);
            }
        }
        else
        {
            stateMess.Text = "Недопустимая длинна заголовка!";
        }
    }
}